#include "surface.h"
#include "../core.h"
#include "../in/inputmanager.h"
#include "../om/objectmanager.h"

namespace ShCo
{

class SurfaceImpl : public Impl<Surface>
{
public:
    void init();
    void exit();
    InputManager* _IM;
    ObjectManager* _OM;
};

void SurfaceImpl::init()
{
    SH_Q(Surface);
    _IM = new InputManager();
    _OM = new ObjectManager();
    surface = q;
    IM = _IM;
    OM = _OM;
}

void SurfaceImpl::exit()
{
    SH_SAFE_DELETE(_IM);
    SH_SAFE_DELETE(_OM);
}

Surface::Surface()
{
    SH_I(Surface);
    d->init();
}

Surface::~Surface()
{
    SH_E(Surface);
    d->exit();
}

InputManager* Surface::inputManager() const
{
    SH_D(const Surface);
    return d->_IM;
}

ObjectManager* Surface::objectManager() const
{
    SH_D(const Surface);
    return d->_OM;
}

void Surface::event(const SsUiEvent* evt)
{
    SH_D(Surface);
    d->_IM->event(evt);
}

} // namespace ShCo
